package net.admin.action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.admin.db.item.CategoryDAO;

public class CategorySearchAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ActionForward af = new ActionForward();
		ArrayList list = null;
		CategoryDAO dao = null;
		boolean result=false;
		af.setRedirect(false);
		af.setPath("/admin/item/category_search.jsp");
		
		try{
			dao = new CategoryDAO();
			list=dao.getCategoryList();
			request.setAttribute("result", "Y");
			request.setAttribute("list", list);
		}catch(Exception e){
			e.printStackTrace();
			request.setAttribute("result", "N");
		}finally{
			if(dao!=null)dao.close();
		}
		
		return af;
	}

}
